package alert

Import Path
	github.com/K-Phoen/grabana/alert (on go.dev)

Dependency Relation
	imports 6 packages, and imported by 5 packages

Involved Source Files alert.go condition.go queries.go
Package-Level Type Names (total 8)
/* sort by: | */
Alert represents an alert that can be triggered by a query. Builder *sdk.Alert DashboardUID string For internal use only PanelID string (*Alert) HookDashboardUID(uid string) (*Alert) HookDatasourceUID(uid string) (*Alert) HookPanelID(id string) func New(name string, options ...Option) *Alert func github.com/K-Phoen/grabana/dashboard.(*Builder).Alerts() []*Alert func github.com/K-Phoen/grabana/row.(*Row).Alerts() []*Alert func github.com/K-Phoen/grabana.(*Client).AddAlert(ctx context.Context, namespace string, alertDefinition Alert, datasourcesMap map[string]string) error
Channel represents an alert notification channel. See https://grafana.com/docs/grafana/latest/alerting/notifications/#notification-channel-setup ID uint Name string Type string UID string
ConditionEvaluator represents an option that can be used to configure a condition. func HasNoValue() ConditionEvaluator func IsAbove(value float64) ConditionEvaluator func IsBelow(value float64) ConditionEvaluator func IsOutsideRange(min float64, max float64) ConditionEvaluator func IsWithinRange(min float64, max float64) ConditionEvaluator func If(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option func IfOr(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option
ErrorMode represents the behavior of an alert in case of execution error. func OnExecutionError(mode ErrorMode) Option const ErrorAlerting const ErrorKO const ErrorOK
NoDataMode represents the behavior of an alert when no data is returned by the query. func OnNoData(mode NoDataMode) Option const NoDataAlerting const NoDataEmpty const NoDataOK
Operator represents a logical operator used to chain conditions. const And const Or
Option represents an option that can be used to configure an alert. func Description(content string) Option func EvaluateEvery(interval string) Option func For(duration string) Option func If(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option func IfOr(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option func OnExecutionError(mode ErrorMode) Option func OnNoData(mode NoDataMode) Option func Runbook(url string) Option func Summary(content string) Option func Tags(tags map[string]string) Option func WithGraphiteQuery(ref string, query string, options ...graphite.Option) Option func WithInfluxDBQuery(ref string, query string, options ...influxdb.Option) Option func WithLokiQuery(ref string, query string, options ...loki.Option) Option func WithPrometheusQuery(ref string, query string, options ...prometheus.Option) Option func WithStackdriverQuery(query *stackdriver.Stackdriver) Option func New(name string, options ...Option) *Alert func github.com/K-Phoen/grabana/graph.Alert(name string, opts ...Option) graph.Option func github.com/K-Phoen/grabana/timeseries.Alert(name string, opts ...Option) timeseries.Option
QueryReducer represents a function used to reduce a query to a single value that can then be fed to the evaluator to determine if the alert will be triggered or not. func If(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option func IfOr(reducer QueryReducer, queryRef string, evaluator ConditionEvaluator) Option const Avg const Count const Diff const Last const Max const Median const Min const PercentDiff const Sum
Package-Level Functions (total 21)
Description sets the description associated to the alert.
EvaluateEvery defines the evaluation interval.
For sets the time interval during which a query violating the threshold before the alert being actually triggered. See https://grafana.com/docs/grafana/latest/alerting/rules/#for
HasNoValue will match queries returning no value.
If defines a single condition that will trigger the alert. See https://grafana.com/docs/grafana/latest/alerting/rules/#conditions
IfOr defines a single condition that will trigger the alert. See https://grafana.com/docs/grafana/latest/alerting/rules/#conditions
IsAbove will match queries returning a value above the given threshold.
IsBelow will match queries returning a value below the given threshold.
IsOutsideRange will match queries returning a value outside the given range.
IsWithinRange will match queries returning a value within the given range.
New creates a new alert.
OnExecutionError defines the behavior on execution error. See https://grafana.com/docs/grafana/latest/alerting/rules/#execution-errors-or-timeouts
OnNoData defines the behavior when the query returns no data. See https://grafana.com/docs/grafana/latest/alerting/rules/#no-data-null-values
Runbook sets the runbook URL associated to the alert.
Summary sets the summary associated to the alert.
Tags defines a set of tags that will be forwarded to the notifications channels when the alert will tbe triggered or used to route the alert.
WithGraphiteQuery adds a graphite query to the alert.
WithInfluxDBQuery adds an InfluxDB query to the alert.
WithLokiQuery adds a loki query to the alert.
WithPrometheusQuery adds a prometheus query to the alert.
WithStackdriverQuery adds a Stackdriver query to the alert.
Package-Level Constants (total 17)
And chains conditions with a logical AND
Avg defines the query to execute and computes the average of the results. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Count defines the query to execute and counts the results. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Alerting will set the alert state to "alerting".
LastState will set the alert state to its previous state.
LastState will set the alert state to its previous state.
Last defines the query to execute and takes the last result. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Max defines the query to execute and takes the largest result. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Median defines the query to execute and computes the mediam of the results. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Min defines the query to execute and takes the smallest result. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Error will set the alert state to "alerting".
NoData will set the alert state to "no data".
OK will set the alert state to "ok".
Or chains conditions with a logical OR
PercentDiff defines the query to execute. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example
Sum defines the query to execute and computes the sum of the results. See https://grafana.com/docs/grafana/latest/alerting/rules/#query-condition-example